*Paper: "The Gender Promotion Gap: Evidence from Central Banking" (RESTAT MS 22860)
*File: Profiles regressions.do
*Authors: Laura Hospido (laura.hospido@bde.es) & Luc Laeven (Luc.laeven@ecb.int) & Ana Lamo (ana.lamo@ecb.int)
*This version: October 2020
*---------------------------------------------------------------------------

clear all
set more off
global master_ECB `""D:\Data""' /*to be changed by the user*/
cd $master_ECB

sysdir set PLUS "D:\ado\plus"  /*to be changed by the user*/

*---------------------------------------------------------------------------
***  Wages***
*---------------------------------------------------------------------------

import delimited profiles, case(preserve) clear
run labels1.do

tab year,gen(year)
tab month,gen(month)

gen year2011 = (year>=2011) 
label variable year2011 "2011 and after"

gen lsteptotal= log(steptotal)

tab salaryband,gen(band)
label var band1 "Expert, band F/G"
label var band2 "Principal Expert, band H"
label var band3 "Advisor, band I"


sort pid year month
tostring year month, replace
replace month="01" if month=="1"
replace month="02" if month=="2"
replace month="03" if month=="3"
replace month="04" if month=="4"
replace month="05" if month=="5"
replace month="06" if month=="6"
replace month="07" if month=="7"
replace month="08" if month=="8"
replace month="09" if month=="9"
gen period=year+month
destring period, replace
destring year month, replace

lab var period "Period, yearmonth"

gen fband2=female*band2
gen fband3=female*band3
gen female_children=female*children
gen female_mtenure=female*mtenure
gen female_HHallowance=female*HHallowance
gen children_HHallowance=children*HHallowance
gen female_children_HHallowance=female*children*HHallowance
gen female_y2_topPerf=female*y2_topPerf
gen female_y2_bonus=female*y2_bonus 
gen female_y2_mentee=female*y2_mentee
gen female_sumPLeave=female*sumPLeave

label var fband2 "Female x Salary band H"
label var fband3 "Female x Salary band I"
label var female_children "Female x Children"
label var female_mtenure "Female x Tenure"
label var female_HHallowance "Head of Household x Female"
label var children_HHallowance "Head of Household x Children"
label var female_children_HHallowance "Head of Household x Female x Children"
label var children_HHallowance "children x Head of household"
label var female_y2_topPerf "Female x Top performer"
label var female_y2_bonus "Female x Bonus"
label var female_y2_mentee "Female x Mentee"
label var female_sumPLeave"Female x Unpaid parental leave"

save temp1, replace

*---------------------------------------------------------------------------
***  Promotions***
*---------------------------------------------------------------------------


/*dropping those who are Principal experts or Advisors (band H and I )but were not promoted during the time sample */

keep if sample_promotions==1 

save temp2, replace 

**---------------------------------------------------------------------------
*** Table 2:  Linear regression of logwages***
**---------------------------------------------------------------------------

use temp1,clear
eststo clear
eststo:regress lsteptotal female mtenure dir1-dir8 age1-age5 year1-year15 month1-month11, vce (cluster pid)
eststo:regress lsteptotal female mtenure band2 band3 dir1-dir8 age1-age5 year1-year15 month1-month11, vce (cluster pid)
eststo:regress lsteptotal female mtenure dir1-dir8 age1-age5 year1-year15 month1-month11 if band1==1, vce (cluster pid)
esttab using "Table2.txt", b(4) se(3) r2(4) star(* 0.1 ** 0.05 *** 0.01) label title(Table 2: Linear regression of logwages) /*
*/ nonumbers mtitles("(1)" "(2)"  "(3) Within Expert level" ) addnote("Department, time, and age dummies included.") keep(female mtenure band2 band3 ) replace 

**---------------------------------------------------------------------------
*** Table 3:  Probability of Promotion from Expert level***
**---------------------------------------------------------------------------

use temp2,clear
eststo clear
eststo a1: regress Perpromotion female mtenure  children  dir1-dir8 year1-year15 month1-month11 age1-age5  , vce (cluster pid)
eststo a2: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children   dir1-dir8 year1-year15 month1-month11 age1-age5  , vce (cluster pid)
eststo a3: regress Perpromotion female mtenure y2_topPerf y2_bonus y2_mentee children  sumMatAdop sumPLeave  dir1-dir8 year1-year15 month1-month11 age1-age5  , vce (cluster pid)
eststo b3: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee sumMatAdop sumPLeave children dir1-dir8 year1-year15 month1-month11 age1-age5  if year2011==0, vce (cluster pid)
eststo f3: regress  Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee sumMatAdop sumPLeave children  dir1-dir8 year1-year15 month1-month11 age1-age5  if year2011==1, vce (cluster pid)
esttab a1 a2 a3 b3 f3 using "Table3.txt", b(5) se(5) r2(3) star(* 0.1 ** 0.05 *** 0.01) label title(Table 3: Probability of promotion from Expert level) /*
*/ nonumbers mtitles("(1)" "(2)" "(3)"  "(4) Before 2011"  "(5) From 2011")  addnote("Department, time, and age dummies included.") keep(female mtenure  y2_topPerf y2_bonus y2_mentee sumMatAdop sumPLeave children ) replace 

**-------------------------------------------------------------------------
*** Table 6:  Wage gap following promotion***
**-------------------------------------------------------------------------

use temp1,clear
eststo clear
eststo :regress lsteptotal female mtenure band2 band3 fband2 fband3 dir1-dir8 age1-age5 year1-year15 month1-month11, vce (cluster pid)
eststo :regress lsteptotal female mtenure band2 band3 fband2 fband3 dir1-dir8 age1-age5 year1-year15 month1-month11 if year2011==0, vce (cluster pid)
eststo :regress lsteptotal female mtenure band2 band3 fband2 fband3 dir1-dir8 age1-age5 year1-year15 month1-month11 if year2011==1, vce (cluster pid)
esttab using "Table6.txt", b(4) se(4) r2(3) star(* 0.1 ** 0.05 *** 0.01) label title(Table 6: Wage gap following promotion) /*
*/ nonumbers mtitles("(1)" "(2)Before 2011" "(3)From 2011" )  addnote("Department, time, and age dummies included.") keep(female mtenure band2 band3 fband2 fband3 ) replace 

*---------------------------------------------------------------------------
*** Table A.3:  Linear regression of logwages. Children***
*---------------------------------------------------------------------------

use temp1,clear
xtset pid period
eststo clear
eststo:regress lsteptotal female mtenure band2 band3 children age1-age5 dir1-dir8 year1-year15 month1-month11, vce (cluster pid)
eststo: xtreg  lsteptotal  mtenure band2 band3 children female_children age1-age5 dir1-dir8 year1-year15 month1-month11, vce (cluster pid) fe
eststo:regress lsteptotal female mtenure band2 band3 children  HHallowance children_HHallowance age1-age5 dir1-dir8 year1-year15 month1-month11, vce (cluster pid)
eststo: xtreg  lsteptotal mtenure band2 band3 children female_children HHallowance children_HHallowance female_HHallowance female_children_HHallowance age1-age5 dir1-dir8 year1-year15 month1-month11, vce (cluster pid) fe
esttab using "TableA3.txt", b(4) se(4) r2(3) ar2(3) star(* 0.1 ** 0.05 *** 0.01) label title(Table A3: Linear regression of logwages. Children) /*
*/ nonumbers mtitles("(1) OLS" "(2) FE" "(3) OLS" "(4) FE" )  addnote("Department, time, and age dummies included.") keep(female mtenure band2 band3 children female_children HHallowance children_HHallowance female_HHallowance female_children_HHallowance) replace 


use temp1,clear
xtset pid period 
eststo clear
eststo:regress lsteptotal female mtenure  children age1-age5 dir1-dir8 year1-year15 month1-month11 if band1==1, vce (cluster pid)
eststo: xtreg  lsteptotal  mtenure  children female_children age1-age5 dir1-dir8 year1-year15 month1-month11 if band1==1, vce (cluster pid) fe
eststo:regress lsteptotal female mtenure  children  HHallowance children_HHallowance age1-age5 dir1-dir8 year1-year15 month1-month11 if band1==1, vce (cluster pid)
eststo: xtreg  lsteptotal mtenure  children female_children HHallowance children_HHallowance female_HHallowance female_children_HHallowance age1-age5 dir1-dir8 year1-year15 month1-month11 if band1==1, vce (cluster pid) fe
esttab using "TableA3_continuation.txt", b(4) se(4) r2(3) ar2(3) star(* 0.1 ** 0.05 *** 0.01) label title(Table A3 cont: Linear regression of logwages. Children) /*
*/ nonumbers mtitles("(1) OLS" "(2) FE" "(3) OLS" "(4) FE" )  addnote("Department, time, and age dummies included.") keep(female mtenure  children female_children HHallowance children_HHallowance female_HHallowance female_children_HHallowance) replace 

**---------------------------------------------------------------------------
*** Table A4:  Gender gap in promotion probability over time***
**---------------------------------------------------------------------------

use temp2,clear
gen int1=0
replace int1=1 if 2003<=year & year<=2005
gen int2=0
replace int2=1 if 2004<=year & year<=2006
gen int3=0
replace int3=1 if 2006<=year & year<=2008
gen int4=0
replace int4=1 if 2007<=year & year<=2009
gen int5=0
replace int5=1 if 2008<=year & year<=2010
gen int6=0
replace int6=1 if 2009<=year & year<=2011
gen int7=0
replace int7=1 if 2010<=year & year<=2012
gen int8=0
replace int8=1 if 2011<=year & year<=2013
gen int9=0
replace int9=1 if 2012<=year & year<=2014
gen int10=0
replace int10=1 if 2013<=year & year<=2015
gen int11=0
replace int11=1 if 2014<=year & year<=2016
gen int12=0
replace int12=1 if 2015<=year & year<=2017
eststo clear
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int1==1  , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int2==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int3==1, vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int4==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int5==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int6==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int7==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int8==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int9==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int10==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int11==1 , vce (cluster pid)
eststo: regress Perpromotion female mtenure  y2_topPerf y2_bonus y2_mentee children    dir1-dir8 year1-year15 month1-month11 age1-age5 if int12==1 , vce (cluster pid)
esttab using "TableA4.txt", b(4) se(4) r2(3) star(* 0.1 ** 0.05 *** 0.01) label title(Table A4: Gender gap in promotion probability over time) /*
*/ nonumbers mtitles("2003-05" "2004-06" "2006-08" "2007-09" "2008-10" "2009-11" "2010-12" "2011-13" "2012-14" "2013-15" "2014-16" "2015-17") /*
*/ addnote("All baseline controls included.") keep(female) replace 

 
*---------------------------------------------------------------------------
*** Table A5:  Probability of promotion. Differential effects***
*---------------------------------------------------------------------------

use temp2,clear
xtset pid period
eststo clear
eststo: xtreg Perpromotion  mtenure female_mtenure y2_topPerf female_y2_topPerf y2_bonus female_y2_bonus  y2_mentee female_y2_mentee children female_children sumMatAdop sumPLeave female_sumPLeave dir1-dir8 year1-year15 month1-month11 age1-age5, vce (cluster pid) fe
eststo: xtreg Perpromotion  mtenure female_mtenure y2_topPerf female_y2_topPerf y2_bonus female_y2_bonus  y2_mentee female_y2_mentee children female_children sumMatAdop sumPLeave female_sumPLeave dir1-dir8 year1-year15 month1-month11 age1-age5 if year<2011, vce (cluster pid) fe
eststo: xtreg Perpromotion  mtenure female_mtenure y2_topPerf female_y2_topPerf y2_bonus female_y2_bonus  y2_mentee female_y2_mentee children female_children sumMatAdop sumPLeave female_sumPLeave dir1-dir8 year1-year15 month1-month11 age1-age5 if year>2010, vce (cluster pid) fe
esttab using "TableA5.txt", b(5) se(5) r2(3)  star(* 0.1 ** 0.05 *** 0.01) label title(Table A5: Probability of promotion: Differential effects) /*
*/ nonumbers mtitles("(1)" "(2) Before 2011" "(3) From 2011")  addnote("Department, time, and age dummies included.") /*
*/ keep( mtenure female_mtenure y2_topPerf female_y2_topPerf y2_bonus female_y2_bonus y2_mentee female_y2_mentee children female_children sumMatAdop sumPLeave female_sumPLeave) replace 

erase temp1.dta
erase temp2.dta 
